//
//  BoxCostHeadView.m
//  XLDoctor
//
//  Created by longma on 2018/10/8.
//  Copyright © 2018年 XLH. All rights reserved.
//

#import "MemberInfoHeadView.h"

@implementation MemberInfoHeadView

- (void)awakeFromNib{
    [super  awakeFromNib];
    [self.encryptButton setImage:MJUIImageMake(@"icon_biyan") forState:0];
    [self.encryptButton setImage:MJUIImageMake(@"icon_zhengyan") forState:UIControlStateSelected];
}

- (void)setPatientModel:(PatientModel *)patientModel {
    _patientModel = patientModel;
    
    self.heightLabel.text = patientModel.height ? [@(patientModel.height).description stringByAppendingString:@"cm"] : @"--";
    self.weightLabel.text = patientModel.weight ? [@(patientModel.weight).description stringByAppendingString:@"kg"] : @"--";
    self.gendeLabel.mj_localizable = patientModel.gender;
    self.ageLabel.text = @(patientModel.age).description;
    self.nameLabel.text = patientModel.patientName;
    if(patientModel.phoneNumber.length){
        self.phoneStackView.hidden = false;
        self.phoneLabel.text = patientModel.phoneNumber.mj_securePhoneNumber;
    }else{
        self.phoneStackView.hidden = true;
    }
    [self.iconImageView mj_setHeadImageWithURLString:patientModel.headPic gender:patientModel.gender];
}

- (IBAction)handleEncryptButtonClick:(UIButton *)sender {
    [self.encryptButton setSelected:!sender.isSelected];
    
    if(sender.isSelected){
        self.phoneLabel.text = self.patientModel.phoneNumber;
    }else{
        self.phoneLabel.text = self.patientModel.phoneNumber.mj_securePhoneNumber;
    }
}
@end






